package cn.bdqn.controller;


import cn.bdqn.bean.result.ResultGenerator;
import cn.bdqn.domain.Doctor;
import cn.bdqn.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/SYS/doctor")
public class DoctorController {


    @Autowired
    private DoctorService doctorService;

    /**
     *  根据id删除医生信息
     * @param id 医生主键id
     * @return  是否成功
     */
    @GetMapping("/deleteByid")
    public int deleteDoctorInformation(Integer id){ return doctorService.takeOffByid(id); }

    /**
     * 添加医生全部信息
     * @param record 需要新增的医生信息
     * @return 是否成功
     */
    @GetMapping("/save")
    public int insertDoctorInformation(Doctor record){return doctorService.addDoctorInformation(record);}

    /**
     * 添加医生部分信息
     * @param record 需要增加的医生信息
     * @return 是否成功
     */
    @GetMapping("/saveSelectice")
    public int insertSelective(Doctor record){return  doctorService.addSelective(record);}

    /**
     *  根据id查询医生信息
     * @param id 医生id主键
     * @return 医生信息
     */
    @GetMapping("/selectOne")
    public Doctor selectDoctorInformationByid(Integer id){return doctorService.queryDoctorInformation(id);}

    /**
     * 修改医生信息
     * @param record 需要修改的医生信息
     * @return 是否成功
     */
    @GetMapping("/updateByid")
    public int updateDoctorInformationByid(Doctor record){return doctorService.changeDoctorInformationById(record);}

    /**
     * 修改部分医生信息
     * @param record 需要修改的医生信息
     * @return 是否成功
     */
    @GetMapping("/updateByidSelective")
    public int updateDoctorInformationSelective(Doctor record){return doctorService.changeDoctorInformationByidSelective(record);}

}
